<< C:\drorbn\AcademicPensieve\Projects\Mathematica\LinAlg.m

Rerouting[n_]:=Module[
{P1, P2, rrt},
rrt = Total[(Signature[#]*(P1@#))& /@ Permutations[Range[n]]];
Expand[rrt*(rrt /. P1 -> P2)] /. P1[p1_]P2[p2_] :> (
P@@(p1~Join~(p2+n)) - P@@((p1+n)~Join~p2)
)
];
Lambda[m_, n_, auxins_List, auxouts_List] := Module[
{basic, ins, outs},
ins = Complement[Range[m], auxins];
outs = Complement[Range[m], auxouts];
basic=P@@Range[m];
basic[[auxins]]=auxouts;
basic[[ins]] = outs;
Total[
(basic /. Thread[outs -> #]& /@ Permutations[outs]) /. 
p_P :>Signature[p]*p
]
];
AllLambdas[m_,n_] := Flatten[Outer[
Lambda[m,n,#1,#2]&,
Subsets[Range[m], {m-n}],
Permutations[Range[m], {m-n}],
1
]]

Rerouting[2]

Lambda[6,4,{3,5}, {5,2}]

AllPs[m_] := (P@@#)& /@ Permutations[Range[m]];

LC2SA[AllPs[6], Lambda[6,4,{3,5}, {5,2}]]

Subsets[Range[4], {3}]

AllLambdas[4,3]

AllLambdas2 = Flatten[Table[
Lambda[4,3,{i},{j}],
{i,4}, {j,4}
]]

List[
LC2SA[AllPs[4], AllLambdas2],
LC2SA[AllPs[4], Rerouting[2]]
]

MatrixRank[LC2SA[AllPs[4], AllLambdas2]]

LinearSolve[
Transpose[LC2SA[AllPs[4], AllLambdas2]],
LC2SA[AllPs[4], Rerouting[2]]
]

NullSpace[LC2SA[AllPs[4], AllLambdas2] // Transpose]

LinearSolve[
Transpose[LC2SA[AllPs[6], AllLambdas[6,4]]],
LC2SA[AllPs[6], Rerouting[3]]
]

LinearSolve[
Transpose[LC2SA[AllPs[8], AllLambdas[8,5]]],
LC2SA[AllPs[8], Rerouting[4]]
]